local killed = achievements.GetValue( "Starship Trooper", "total", 0 )
local flying = { "npc_antlion", "npc_antlionguard", "npc_antlion_worker", "npc_antlion_grub" }
local function PlayerKilledNPC( msg )
	local victim, inflictor, attacker = msg:ReadString(), msg:ReadString(), msg:ReadEntity()
	
	if ( killed != 200 && attacker == LocalPlayer() ) then
		if ( table.HasValue( flying, victim ) ) then
			killed = math.Clamp( killed + 1, 0, 200 )
			achievements.Update( "Starship Trooper", killed / 200, killed .. "/200" )
			achievements.SetValue( "Starship Trooper", "total", killed )
		end
	end		
	
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilledNPC", "Achievements.StarshipTrooper", PlayerKilledNPC )

achievements.Register( "Starship Trooper", "Kill 200 antlions.", "achievements/starship", killed / 200, killed .. "/200" )